package com.smart.introduce;

/**
 * Performace:表演执行
 */
public class MethodPerformace {
	private long begin; // 开始时间
	private long end; // 结束时间
	private String serviceMethod;
    public MethodPerformace(String serviceMethod){
    	reset(serviceMethod);
    }

    /**
     * 打印输出
     */
    public void printPerformace(){
        end = System.currentTimeMillis();
        long elapse = end - begin;
        System.out.println(serviceMethod+"花费"+elapse+"毫秒。");
    }

    /**
     * 设置方法名称
     * 和开始时间
     * @param serviceMethod
     */
    public void reset(String serviceMethod){
    	this.serviceMethod = serviceMethod;
    	this.begin = System.currentTimeMillis();
    }
}
